#include<stdio.h>
int leap(int n){
	if((n%4==0&&n&100==0)||n%400==0)
		return 1;
	else
		return 0;
}
int main(){
	int year,month,day,days=0;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int a_leap[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	scanf("%d/%d/%d",&year,&month,&day);
	if(leap(year)){
		for(int i=0;i<month-1;i++){
			days=days+a_leap[i];
		}
	}
	else{
		for(int i=0;i<month-1;i++){
			days=days+a[i];
		}
	}
	printf("%d",days+day);
	return 0;
}
